﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/**
 * 子弹补给包
 */
public class BulletBag : MonoBehaviour
{
    public int bulletCount = 10;//包里含有的子弹数量

    public ParticleSystem collectEffect;//拾取特效
    void OnTriggerEnter2D(Collider2D other) {
        PlayerController pc = other.GetComponent<PlayerController>();
        if (pc != null) {
            if (pc.MyCurBulletCount < pc.MyMaxBullectCount) {
                pc.ChangeBulletCount(bulletCount);//增加玩家的子弹数
                Instantiate(collectEffect, transform.position, Quaternion.identity);//添加拾取特效
                Destroy(this.gameObject);
            }
        }
    }

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
